﻿using System;
using System.Collections;
using System.Collections.Generic;
namespace WPFExcelReport
{
    public class EK03YARNReport : BaseReport
    {
        #region ----------------Variable---------------------------------
         
        string strCompany;
        string strExcelFile; 
        #endregion
        public EK03YARNReport()
            : base()
        {
        }
        public EK03YARNReport(Dictionary<string, object> dicParamater)
            : base(dicParamater)
        {
            columns.Add("VORDERDATE"); columns.Add("HLTNUM"); columns.Add("ABPART"); columns.Add("ABPVAR"); columns.Add("LSNAME1"); columns.Add("ABPSOLLMENGE5"); columns.Add("ABPAUFKRS"); columns.Add("ABPAUFLFD"); columns.Add("ABPAUFPOS"); columns.Add("VKPAUFKRS"); columns.Add("VKPAUFLFD"); columns.Add("VKPAUFPOS"); columns.Add("SENDDATE"); columns.Add("ABPLIEFDAT"); columns.Add("VKPMENGE1");
            strCompany = dicParamater["Company"].ToString().Trim();
            strExcelFile = dicParamater["ExcelFile"].ToString().Trim();
        }
        public void WriteExcelReport(string fileType)
        {
            Queue CellQueue = new Queue();

            string filename = "";
            string sheetName = "";
            string Standard = "EK03YARN";
            strExcelFile = @"HLT\HLTPlanningReport.xls";
            string filePath = @"C:\intex.w\Report\" + strExcelFile;
            exAgent.Open(filePath);
            exAgent.Company = strCompany;
            exAgent.strExcelFile = strExcelFile;
            string filedate = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString();
            filename = @"Planning\采购\EK" + filedate + ".xls";
            sheetName = DateTime.Now.ToShortTimeString().Replace(@":", "");
            exAgent.CreateNewSheet(filename, Standard, sheetName);
            FillInData(columns, dsSource.Tables["ABPOS"]);
            if (exAgent != null)
            {
                exAgent.Save();
                exAgent.Close();
            }
        }
    }

}
